var str1 = 'xiao liu';
var str2 = 'xiu yun';
// 1.字符串拼接
console.log(str1.concat(str2));
// 2.字符串长度
console.log(str1.length);
// 3.返回指定位置的字符
console.log(str1.charAt(2));
// 4.字符串中子串位置
console.log(str1.indexOf('li'));
// 5.截取部分子串
console.log(str1.slice(1, 6));
// 6.截取部分子串
console.log(str1.substring(1, 6));
// 7.trim 去除字符串两端的空白字符
var str3 = '  xiu yun  ';
console.log(str3.trim());
// 8.replace(regexp|substr, newSubstr|function)
var str4 = 'python java python is a good language javascript python java';
console.log(str4.replace('java', 'php'));
console.log(str4.replace('java', function (str) {
    return str.toUpperCase();
}));
console.log(str4.replace(/java/g, 'php'));
